<template>
	<view class="waitingList_container">
		<view class="" style="height: 160rpx;">
			<view class="mail_List fixed z_ninetynine">
				<view class="mail" style="font-weight: 700;">
					<view class="order">巡更详情</view>
				</view>
			</view>
			<view class="icon fixed z_ninetynine">
				<u-icon name="arrow-left" color="#fefefe" size="40" @click="navigateBack"></u-icon>
			</view>

		</view>
		<!-- 执行信息1 -->
		<view class="data_Statistics" style="padding: 44rpx 24rpx 0 ;" v-show="flag">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">执行信息</text>
		</view>
		<view class="card" style="position: relative; padding: 0 42rpx;" v-show="flag">
			<u-form :model="form" ref="uForm">
				<u-form-item label="执行人:">
					<u-input v-model="form.Reporter"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="item.staffName" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="执行状态:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="待执行"
						:clearable="false" :disabled="true" />
				</u-form-item>
				<image src="/static/workOrder/Group801.png" mode=""
					style=" position: absolute;top: 20rpx; left: 236rpx; width: 280rpx; height: 280rpx;">
				</image>
			</u-form>
		</view>
		<!-- 执行信息2 -->
		<view class="data_Statistics" style="padding: 44rpx 24rpx 0 ;">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">执行信息2</text>
		</view>
		<view class="card" style="position: relative; padding: 0 42rpx;">
			<u-form :model="form" ref="uForm">
				<u-form-item label="执行人:">
					<u-input v-model="form.Reporter"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.staffName" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="执行状态:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="待接单"
						:clearable="false" :disabled="true" v-if="patrolOrder.patrolStatus=='0'" />
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="待执行"
						:clearable="false" :disabled="true" v-if="patrolOrder.patrolStatus=='1'" />
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="完成"
						:clearable="false" :disabled="true" v-if="patrolOrder.patrolStatus=='2'" />
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="超时完成"
						:clearable="false" :disabled="true" v-if="patrolOrder.patrolStatus=='3'" />
				</u-form-item>
				<u-form-item label="接单时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.updateTime" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="执行时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.updateTime" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="完成时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.realTime" :clearable="false" :disabled="true" />
				</u-form-item>
				<!-- 				<u-form-item label="异常:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="2处"
						:clearable="false" :disabled="true" />
				</u-form-item> -->
				<image src="/static/workOrder/Group690.png"
					style=" position: absolute;top: 210rpx; left: 236rpx; width: 280rpx; height: 280rpx;" v-if="patrolOrder.patrolStatus=='2'">
				</image>
				<image src="/static/workOrder/Group692.png"
					style=" position: absolute;top: 210rpx; left: 236rpx; width: 280rpx; height: 280rpx;" v-if="patrolOrder.patrolStatus=='3'">
				</image>
			</u-form>
		</view>
		<!-- 巡更信息 -->
		<view class="data_Statistics" style="padding: 28rpx 24rpx 0 ;">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">巡更信息</text>
		</view>
		<view class="card" style="padding: 0 42rpx;">
			<u-form :model="form" ref="uForm">
				<u-form-item label="巡更路线名称:">
					<u-input v-model="form.Reporter"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.patrolName" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="路线有效时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.beginTime" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="路线失效时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.endTime" :clearable="false" :disabled="true" />
				</u-form-item>
				<!-- <u-form-item label="巡更频率:"> -->
				<view class="frequency">
					<text style="line-height: 67rpx;">巡更频率:</text>
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrolOrder.duration" :clearable="false" :disabled="true" />
				</view>
				<!-- </u-form-item> -->
				<!-- 				<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
					placeholder="12: 00: 00 至 14: 00: 00" :clearable="false" :disabled="true" />
				<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
					placeholder="14: 00: 00 至 16: 00: 00" :clearable="false" :disabled="true" />
				<view class="example">
					<text style="font-size: 24rpx;flex: 1; color: #ccc;">例如:</text>
					<view style="flex: 6;font-size: 24rpx; color: #ccc;">60分钟巡更一次，允许超时10分钟，即巡更总时长为60分钟,前50分钟为正常，后10分钟为超时
					</view>
				</view> -->
				<!-- 				<u-form-item label="打卡规则:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" :placeholder="particulars.rule=='1'? '顺序' : '无序'"
						:clearable="false" :disabled="true" />
				</u-form-item> -->
			</u-form>
		</view>
		<!-- 巡更路线信息 -->
		<view class="order_Allocation">
			<view class="data_Statistics" style="padding: 28rpx 24rpx 0 ;">
				<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
					style="font-weight: 700; font-size: 30rpx;">巡更路线信息</text>
			</view>
			<view class="card" style="position: relative; padding: 0 42rpx;">
				<u-form :model="form" ref="uForm">
					<!-- 巡更点1 -->
					<u-form-item :label="particulars.dotName" label-position="top">
						<view class="name" style="display: flex;">
							<text>巡点名称: </text>
							<u-input v-model="form.describe"
								placeholder-style="color: #000; margin-left: 20rpx; font-size: 25rpx; "
								:placeholder="patrolOrder.dotName" :clearable="false" :disabled="true" />
						</view>
						<!-- 						<view class="position" style="display: flex;">
							<text>蓝牙位置: </text>
							<u-input v-model="form.describe"
								placeholder-style="color: #000; margin-left: 20rpx; font-size: 25rpx; "
								:placeholder="particulars.content" :clearable="false" :disabled="true" style="flex: 2;" />
						</view> -->
						<view class="points" style="display: flex;">
							<text>巡更要点: </text>
							<view class="main" style="margin-left: 20rpx; flex: 2;">
								<u-input v-model="form.describe" placeholder-style="color: #000; font-size: 25rpx; "
									:placeholder="patrolOrder.content" :clearable="false" :disabled="true" />
								<!-- 								<u-input v-model="form.describe" placeholder-style="color: #000; font-size: 25rpx; "
									placeholder="2、访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" />
								<u-input v-model="form.describe" placeholder-style="color: #000; font-size: 25rpx; "
									placeholder="3、访春园Y20#-1单元门口植物是否伸出" :clearable="false" :disabled="true" /> -->
							</view>
						</view>
					</u-form-item>
					<!-- 巡更点1异常上报 -->
					<view class=""
						style="display: flex;justify-content: space-evenly; color: green; padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;">
						<!-- 无异常 --> {{particulars.patrolResult==0? '正常' : '异常'}}
					</view>
					<!-- 					<view class="position" style="display: flex;padding: 10rpx 0 20rpx 31rpx;border-bottom: 1px solid #f6f7f9;" >
						<text style="color: red;line-height: 70rpx;">异常上报: </text>
						<u-input v-model="form.chargePerson" placeholder-style="color: #000;" :custom-style="{'margin-left': '21rpx'}"
							placeholder="1、访春园Y20#-1单元门口需要清洁" :clearable="false" :disabled="true" style="flex: 2;" />
					</view> -->
					<!-- 巡更点1按钮 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly; padding: 20rpx 0 36rpx; border-bottom: 1px solid #f6f7f9;" v-if="current4==2">
						<u-button type="error" :plain="true" size="mini" shape="circle" @click="reporting4">异常上报</u-button>
						<u-button type="success" size="mini" shape="circle" @click="normal">正常</u-button>
					</view> -->
					<!-- 巡更点1无异常 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly; color: green; padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;" v-if="abnormality3==2">
						无异常
					</view> -->
					<!-- 巡更点2 -->
					<!-- 				<u-form-item label="巡更点2:" label-position="top">
					<view class="name" style="display: flex;">
						<text>巡点名称: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元门禁" :clearable="false" :disabled="true" />
					</view>
					<view class="position" style="display: flex;">
						<text>蓝牙位置: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元玄关处" :clearable="false" :disabled="true" style="flex: 2;" />
					</view>
					<view class="points" style="display: flex; ">
						<text>巡更要点: </text>
						<view class="main" style="margin-left: 20rpx; flex: 2;">
							<u-input v-model="form.describe" placeholder-style="color: #000;  "
								placeholder="1、访春园Y20#-1单元门口是否清洁干净" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="2、访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="3、访春园Y20#-1单元门口植物是否伸出" :clearable="false" :disabled="true" />
						</view>
					</view>
				</u-form-item> -->
					<!-- 巡更点2异常上报 -->
					<!-- 					<view class="position" style="display: flex;padding: 10rpx 0 20rpx 31rpx;border-bottom: 1px solid #f6f7f9;" v-if="flag3">
						<text style="color: red;line-height: 70rpx;">异常上报: </text>
						<u-input v-model="form.Executor" :custom-style="{'margin-left': '21rpx'}"
							placeholder="请输入异常情况" style="flex: 2;" />
					</view> -->
					<!-- 巡更点2按钮 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly;padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;" v-if="current3==2">
						<u-button type="error" :plain="true" size="mini" shape="circle" @click="reporting3">异常上报</u-button>
						<u-button type="success" size="mini" shape="circle" @click="normal2">正常</u-button>
					</view> -->
					<!-- 巡更点3无异常 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly; color: green; padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;">
						无异常
					</view> -->
					<!-- 巡更点3 -->
					<!-- 				<u-form-item label="巡更点3:" label-position="top">
					<view class="name" style="display: flex;">
						<text>巡点名称: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元门禁" :clearable="false" :disabled="true" />
					</view>
					<view class="position" style="display: flex;">
						<text>蓝牙位置: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元玄关处" :clearable="false" :disabled="true" style="flex: 2;" />
					</view>
					<view class="points" style="display: flex; ">
						<text>巡更要点: </text>
						<view class="main" style="margin-left: 20rpx; flex: 2;">
							<u-input v-model="form.describe" placeholder-style="color: #000;  "
								placeholder="1、访春园Y20#-1单元门口是否清洁干净" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="2、访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="3、访春园Y20#-1单元门口植物是否伸出" :clearable="false" :disabled="true" />
						</view>
					</view>
				</u-form-item> -->
					<!-- 巡更点3异常上报 -->
					<!-- 					<view class="position" style="display: flex;padding: 10rpx 0 20rpx 31rpx;border-bottom: 1px solid #f6f7f9;" v-if="flag2">
						<text style="color: red;line-height: 70rpx;">异常上报: </text>
						<u-input v-model="form.Maintenance" :custom-style="{'margin-left': '21rpx'}"
							placeholder="请输入异常情况" style="flex: 2;" />
					</view> -->
					<!-- 巡更点3按钮 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly;padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;" v-if="current2==2">
						<u-button type="error" :plain="true" size="mini" shape="circle" @click="reporting2">异常上报</u-button>
						<u-button type="success" size="mini" shape="circle" @click="normal3">正常</u-button>
					</view> -->
					<!-- 巡更点3无异常 -->
					<!-- 					<view class="" style="display: flex;justify-content: space-evenly; color: green; padding: 20rpx 0 36rpx;border-bottom: 1px solid #f6f7f9;">
						无异常
					</view> -->
				</u-form>
			</view>
		</view>
		<view class="button">
			<!-- <u-button type="primary" style="flex: 1;" v-if="current5==1" @click="receiving">接单</u-button> -->
			<!-- <u-button type="success" style="flex: 1;" v-if="current5==1" @click="Transfer">转交</u-button> -->
			<!-- <u-button type="primary" style="flex: 1;" @click="resolved" v-if="current5==1">执行</u-button> -->
			<!-- <u-button type="primary" style="flex: 1;" @click="resolved" v-if="current==2">提交</u-button> -->
			<u-button type="success" style="flex: 1;" @click="Approved" v-if="current5==3">提交</u-button>
		</view>
		<u-popup v-model="show" mode="center" width="626rpx" height="430rpx" border-radius="20">
			<view
				style="height: 54rpx; line-height: 54rpx; font-weight: 600; color: #a1a1a1; background-color: #fbfbfb; text-align: center;">
				巡更打卡提示</view>
			<view class="work_Order">
				<view class="work_Order_top"></view>
				<view class="work_Order_bottom" style="margin-top: 10rpx;">请在巡更位置打卡！</view>
			</view>
		</u-popup>
		<u-modal v-model="homepage" :show-cancel-button="true" :content="content" width="626rpx" height="430rpx"
			border-radius="20" @confirm="confirm">
			<!-- 			<view
				style="height: 54rpx; line-height: 54rpx; font-weight: 600; color: #a1a1a1; background-color: #fbfbfb; text-align: center;">
				提示</view>
			<view class="work_Order">
				<view class="work_Order_top"></view>
				<view class="work_Order_bottom" style="margin-top: 10rpx;">退出后操作的内容会清空，是否继续</view>
			</view> -->
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// form表单
				form: {
					Reporter: '',
					title: '',
					address: '',
					describe: '',
					chargePerson: '',
					Executor: '',
					Maintenance: '',
					end: ''
				},
				// 演示地址，请勿直接使用
				action: 'http://www.example.com/upload',
				flag: 1,
				// 巡更点异常上报
				flag1: false,
				flag2: false,
				flag3: false,
				flag4: false,
				// 控制弹框
				show: false,
				// 控制巡更点按钮
				current: 1,
				current2: 1,
				current3: 1,
				current4: 1,
				// 控制底部按钮
				current5: 1,
				// 控制接单时间
				image: 2,
				// 控制巡更点无异常
				abnormality: 1,
				abnormality2: 1,
				abnormality3: 1,
				// 模态框
				content: '退出后操作的内容会清空，是否继续',
				homepage: false,
				// 5秒后跳转的变量
				variable: false,
				// 已完成Id
				patrolId: '',
				// 车辆详情
				particulars: '',
				// 审核通过
				staff: '',
				// 控制第一条执行信息
				patrolOrders: '',
				// 控制第二条执行信息以后的信息
				patrolOrder: '',
				// 控制是否显示转交人
				flag: '',

			}
		},
		onLoad(val) {
			this.loginId = uni.getStorageSync("setModel")
			console.log(val)
			if (val.patrolId) {
				this.patrolId = val.patrolId
				// 已完成详情
				this.getListVehicleByIds()
			}
			// this.loading()
		},
		methods: {
			// 已完成详情
			getListVehicleByIds() {
				this.$http.get('Patrol/selectThreePatrolById', {
					patrolId: this.patrolId
				}).then(res => {
					this.particulars = res.data
					let patrolOrder = res.data.patrol
					let patrolOrders = res.data.patrolMembers
					this.patrolOrder = patrolOrder
					if (patrolOrders.length != 0) {
						this.flag = true
						this.patrolOrders = patrolOrders
						console.log(this.patrolOrders)
					}
					console.log(res, '已完成详情')
					// this.owners = res.data
				})
			},
			// 点击接单触发
			receiving() {
				this.image = 2
				this.current5 = 2
			},
			// 点击执行触发
			resolved() {
				this.image = 3,
					this.current = 2,
					this.current2 = 2,
					this.current3 = 2,
					this.current4 = 2,
					this.current5 = 3
			},
			// 点击异常上报触发
			reporting1() {
				// console.log(111)
				this.current = 1
				this.flag1 = true
			},
			// 点击异常上报触发
			reporting2() {
				this.current2 = 1
				this.flag2 = true
			},
			// 点击异常上报触发
			reporting3() {
				this.current3 = 1
				this.flag3 = true
			},
			// 点击异常上报触发
			reporting4() {
				this.current4 = 1
				this.flag4 = true
			},
			// 点击正常按钮触发
			normal() {
				this.current4 = 1
				this.abnormality3 = 2
			},
			// 点击正常按钮触发
			normal2() {
				this.show = true
			},
			// 点击正常按钮触发
			normal3() {
				this.current2 = 1
				this.abnormality = 2
			},
			// 点击正常按钮触发
			normal4() {
				this.current = 1
				this.abnormality2 = 2
			},
			// 点击提交按钮触发
			Approved() {
				if ((this.form.chargePerson != '' || this.abnormality3 == 2) && (this.form.Maintenance != '' || this
						.abnormality == 2) && (this.form.end != '' || this.abnormality2 == 2)) {
					this.image = 4
					this.current5 = 6
					console.log(111)
				}
			},
			// 点击转交按钮触发
			Transfer() {
				console.log(111)
				this.openUrl('/pages/workSecurity/securityImplemented/securityTransfer/securityTransfer')
			},
			// 点击返回按钮触发
			navigateBack() {
				if (this.form.chargePerson != '' || this.abnormality3 == 2 || this.form.Maintenance != '' || this
					.abnormality == 2 || this.form.end != '' || this.abnormality2 == 2) {
					this.homepage = true
					setTimeout(() => {
						this.variable = true
					}, 5000)
				} else {
					uni.navigateBack()
				}
			},
			confirm() {
				if (this.variable == true) {
					this.openUrl('/pages/workSecurity/workSecurity')
					// console.log(11)
				} else {
					this.homepage = true
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.waitingList_container {
		.mail_List {
			overflow: hidden;
			width: 100%;
			background-color: #f2f2f2;

			.mail {
				padding: 10rpx 0;
				// margin-top: 96rpx;
				color: #999999;
				font-size: 40rpx;
				background-color: #e5e5e5;
			}

			.order {
				text-align: center;
			}
		}

		/deep/.card {
			.u-form-item--left {
				flex: unset !important;
				width: unset !important;
			}

			.frequency {
				display: flex;

				// justify-content: space-between;
				u-input {
					flex: 2;
				}
			}

			.example {
				display: flex;
				margin-left: 67rpx;
			}

			.u-form-item--right {
				margin-left: 31rpx;
			}
		}

		.icon {
			position: absolute;
			top: 18rpx;
			// top: 114rpx;
			left: 20rpx;
		}

		.second_card {
			.u-cell {
				padding: 18rpx 32rpx;

				/deep/.u-cell__value {
					color: #333333;
					font-weight: 600;
				}
			}

			/deep/.uni-card__content {
				padding: 16rpx 24rpx;
			}
		}

		.order_Allocation {
			/deep/button {
				width: 170rpx;
			}
		}

		.uni-border[data-v-19622063]:after {
			border: unset;
		}

		/deep/.uni-border.data-v-19622063:after {
			border: unset;
		}

		.slot-btn__hover {
			background-color: rgb(235, 236, 238);
		}

		.button {
			display: flex;
			// position: fixed;
			// left: 0;
			// right: 0;
			// bottom: 0;
			margin-top: 200rpx;
			border-radius: 14rpx;
			overflow: hidden;
			z-index: 9;

			.u-btn {
				border-radius: unset;
			}
		}

		.work_Order {
			margin-top: 60rpx;
			text-align: center;

			.work_Order_top {
				width: 168rpx;
				height: 168rpx;
				margin: 0 auto;
				background-color: #e5e5e5;
				border-radius: 50%;
			}
		}
	}
</style>
